package com.vinoxm.admin.controller;

import com.vinoxm.admin.vo.UserVo;
import com.vinoxm.common.base.result.BaseResult;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class TestController {

    @RequestMapping("/test")
    public BaseResult hello(HttpServletRequest request) {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        UserVo principal = (UserVo) authentication.getPrincipal();
        return BaseResult.Success();
    }
}
